home *** CD-ROM | disk | FTP | other *** search
/ Champak 52 / Volume 52 - JOGO DISK .iso / Games / shopdrop.swf / scripts / __Packages / smashing / Phys.as < prev    next >
Text File  |  2007-09-27  |  963b  |  39 lines

  1. class smashing.Phys
  2. {
  3.    static var gr = 20;
  4.    static var fr = 0.1;
  5.    static var bf = 0.7;
  6.    static var height = 370;
  7.    static var width = 600;
  8.    static var TWOPI = 6.283185307179586;
  9.    static var bInit = smashing.Phys.init();
  10.    function Phys()
  11.    {
  12.    }
  13.    static function drag(f, t, nFric)
  14.    {
  15.       if(nFric == undefined)
  16.       {
  17.          nFric = smashing.Phys.fr;
  18.       }
  19.       return f * (- Math.pow(1 - nFric,t * 27) + 1);
  20.    }
  21.    static function bounce(v, n)
  22.    {
  23.       var _loc2_ = v.reverse();
  24.       var _loc1_ = n.multiply(n.dot(_loc2_));
  25.       v.x = _loc1_.x * smashing.Phys.bf + (_loc1_.x - _loc2_.x);
  26.       v.y = _loc1_.y * smashing.Phys.bf + (_loc1_.y - _loc2_.y);
  27.    }
  28.    static function get up()
  29.    {
  30.       return smashing.Phys.pUp;
  31.    }
  32.    static function init()
  33.    {
  34.       smashing.Phys.pUp = new smashing.Point(0,-1);
  35.       smashing.Phys.pHoriz = new smashing.Point(1,0);
  36.       return true;
  37.    }
  38. }
  39.